package cn.com.headfree;

import cn.com.headfree.base.common.MyConstant;
import cn.com.headfree.util.RedisClusterUtil;
import cn.hutool.core.date.DateTime;
import com.gta.edu.sdk.util.EhCacheUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @Description: 项目启动后执行
 * @Author wcSun
 * @Date 2022/6/27
 **/
@Slf4j
@Component
public class PreApplication implements ApplicationRunner{

    @Override
    public void run(ApplicationArguments applicationArguments) throws Exception {
        log.info("启动成功后先清空字典缓存，当前时间："+ DateTime.now().toString("yyyy-MM-dd HH:mm:ss"));
        EhCacheUtil.remove(MyConstant.CACHE_KEY_SYS_DICT);
        RedisClusterUtil.getInstance().del(MyConstant.CACHE_KEY_SYS_DICT);
    }
}
